#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<errno.h>
#include<unistd.h>

#define N 200

int main()
{
    int fd;
    fd = open("file1.txt",O_RDONLY);
    if(fd == -1)
    {
        perror("fail to open");
        return -1;
    }
    char buf[N] = "";
    ssize_t bytes = 0;
    if((bytes = read(fd,buf,100))== -1)
    {
        perror("fail to read");
        return -1;
    }
    printf("buf = %s\n",buf);
    close(fd);
    return 0;
}